package com.example.controller;

import com.example.common.Result;
import com.example.entity.ClubImage;
import com.example.service.ClubImageService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/club/image")
public class ClubImageController {
    @Resource
    private ClubImageService clubImageService;

    @GetMapping("/list/{clubId}")
    public Result list(@PathVariable Integer clubId) {
        List<ClubImage> images = clubImageService.selectByClubId(clubId);
        return Result.success(images);
    }

    @PostMapping("/add")
    public Result add(@RequestBody ClubImage image) {
        clubImageService.add(image);
        return Result.success();
    }

    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id) {
        clubImageService.deleteById(id);
        return Result.success();
    }
} 